$(function() {

    $('#copy').click(function() {
        $('#my_link').focus();
        $('#my_link').select();
    });

    formComplete = function(data) {
        $('#hold_generate_link').show();
        $('#my_link').val(data);

    }

    $('#generate_link').validate({
        errorElement: "em",
        submitHandler: function(form) {

            form = $('#generate_link');
            var serialize = form.serialize();

            $.ajax({
                url: form.attr('action'),
                method: 'get',
                success: formComplete,
                data: serialize
            });
            return false;

        }
    });

});


